home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigantic Games 2
/
Gigantic Games 2.iso
/
pc
/
new
/
new_1
/
arachnid
/
rowreq.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-12-23
|
3KB
|
99 lines
#include <functions.h>
extern APTR VisualInfo;
extern struct Screen *Scr;
extern struct TextAttr topaz8;
struct Window *RowReqWnd = NULL;
struct Gadget *RowReqGList = NULL;
struct NewGadget RowReqGadget =
{ 0, 30, 35, 20, NULL, &topaz8, 0, PLACETEXT_IN, NULL, NULL};
struct IntuiText RowReqIText[] = {
1, 0, JAM1,15, 8, &topaz8, (UBYTE *)"Bitte die Reihe wählen:", NULL };
UBYTE *GadText[] = {(UBYTE *)"_1",(UBYTE *)"_2",(UBYTE *)"_3",
(UBYTE *)"_4",(UBYTE *)"_5",(UBYTE *)"_6",
(UBYTE *)"_7",(UBYTE *)"_8",(UBYTE *)"_9",(UBYTE *)"1_0"};
void FehlerAus(long nr);
long RowReq()
{
long i,code,class,Karte;
BOOL ende = FALSE;
struct IntuiMessage *message;
struct MsgPort *UserPort;
struct Gadget *gad;
gad = CreateContext(&RowReqGList);
RowReqGadget.ng_VisualInfo = VisualInfo;
for(i=0;i<10;i++)
{
RowReqGadget.ng_LeftEdge = i*35+25;
RowReqGadget.ng_GadgetText = GadText[i];
RowReqGadget.ng_GadgetID = i;
gad = CreateGadget(BUTTON_KIND, gad, &RowReqGadget, GT_Underscore, '_', TAG_DONE);
}
if(!gad)
{
FehlerAus(9);
return(-1);
}
if(!(RowReqWnd = OpenWindowTags(NULL,
WA_Left, 179,
WA_Top, 0,
WA_Width, 400,
WA_Height, 70,
WA_IDCMP, BUTTONIDCMP|IDCMP_INACTIVEWINDOW|IDCMP_VANILLAKEY,
WA_Flags, WFLG_SMART_REFRESH|WFLG_ACTIVATE,
WA_Gadgets, RowReqGList,
WA_Title, NULL,
WA_PubScreen, Scr,
TAG_DONE )))
{
FreeGadgets(RowReqGList);
FehlerAus(7);
return(-1);
}
GT_RefreshWindow(RowReqWnd, NULL);
DrawBevelBox(RowReqWnd->RPort, 15, 20, 370, 40, GT_VisualInfo, VisualInfo, GTBB_Recessed, TRUE, TAG_DONE);
PrintIText(RowReqWnd->RPort, RowReqIText, 0, 0);
UserPort = RowReqWnd->UserPort;
while(!ende)
{
Wait(1L << UserPort->mp_SigBit);
while(message = (struct IntuiMessage *) GT_GetIMsg(UserPort))
{
gad = (struct Gadget*)message->IAddress;
class = message->Class;
code = message->Code;
GT_ReplyIMsg(message);
switch(class)
{
case IDCMP_INACTIVEWINDOW: ActivateWindow(RowReqWnd);
break;
case IDCMP_GADGETUP: Karte = gad->GadgetID;
ende = TRUE;
break;
case IDCMP_VANILLAKEY: if((code < '0')||(code > '9')) break;
Karte = code - '0';
Karte = Karte ? Karte-1 : 9;
ende = TRUE;
}
}
}
CloseWindow(RowReqWnd);
FreeGadgets(RowReqGList);
return(Karte);
}